{{use "jquery"}}
{{link "menus/jquery.navgoco.css"}}
{{link "menus/jquery.navgoco.js"}}

{{def navigation(name='MAIN', active='', check=None, id=None, _class=None):
    out.write(functions.navigation(name=name, active=active, check=check, id=id, _class=_class), escape=False)
pass
}}

{{def sidemenu(name, active='', check=None, id='menus', _class=None):
    out.write(functions.menu(name=name, active=active, check=check, id=id, _class=_class), escape=False)
}}
<script>
$(function() {
    // Initialize navgoco with default options
    var menu = $("#{{=id}}");
    menu.navgoco();
    //show active item
    var active = menu.find('li.active');
    var parents = active.parents('ul');
    if (parents.size() > 0){
        parents.splice(-1, 1);
        $.each(parents, function(i, v){
            menu.navgoco('toggle', true, $(v).data('index'));
        });
    }
    
});
</script>
{{pass}}
